package com.download.web.mapper;

import com.download.backstage.entity.User;
import com.download.web.entity.SysUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author cmy
 * @since 2019-02-20
 */
public interface SysUserMapper extends BaseMapper<SysUser> {

    @Select(" select u.*,i.name userState from sys_user u " +
            " LEFT JOIN bus_dic_item i on u.state=i.id " +
            " limit ${pageIndex},${pageSize}")
    List<User> userList(Integer pageIndex, Integer pageSize);
    @Select(" select count(1) from sys_user u  ")
    Integer userCount();

    @Update("update sys_user set head_img=#{headImg} where id=#{userId}")
    int updateHeadImg(@Param("headImg") String headImg, @Param("userId") Integer userId);
    @Update("update sys_user set user_name=#{userName} where id=#{userId}")

    int updateUserName(@Param("userName") String userName, @Param("userId") Integer userId);

    @Update("update sys_user set pwd=#{pwd} where id=#{userId}")
    int updatePwd(@Param("pwd") String pwd, @Param("userId") Integer userId);

}
